package net.wanho.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;

/**
 * Author：汤小洋
 * Date：2023-12-21 15:40
 * Description：<描述>
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
    private Integer id;

    @NotBlank(message = "用户名不能为空")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Length(min = 6,max = 12,message = "密码长度必须在6-12位之间")
    private String password;

    @Range(min = 1,max = 120,message = "年龄必须在1-120之间")
    private Integer age;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Past(message = "生日必须是过去的时间")
    private Date birthday;

}
